import sys
import numpy as np
from mcmcParser import MCMCParser

def parseImage(index):
	xml =  '../grammar/LivingroomNew.xml'
# 	workPath = '../../'
# 	workPath = '/Users/Liquid/Files/Google Drive/experiment/UIUC/'
# 	workPath = 'C:/Users/Yibiao/GoogleDrive/Work/experiment/UIUC/'
	workPath = 'C:/Users/Siyuan Qi/Google Drive/experiment/UIUC/'
	with open(workPath+'images/imageList_Livingroom.txt') as imageList:
		if index == -1:
			for img in imageList:
				print img.rstrip()
				parser = MCMCParser(xml, img, workPath)
				parser.run()
		else:
			for i, img in enumerate(imageList):
				if i == index:
					print img.rstrip()
					parser = MCMCParser(xml, img, workPath)
					parser.run()

if __name__ == "__main__":
	np.random.seed(100)
	if len(sys.argv)>1:
		parseImage(int(sys.argv[1]))
	else:
		parseImage(0)